using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FrameWork.Source.Texture;

namespace FrameWork.Source.Animation_class
{
    class CSprite
    {

        public CTexture m_pImage { get; set; } 
        /// <summary>
        /// Get or set color for this sprite
        /// </summary>
        public Color m_pColor { get; set; }

        /// <summary>
        /// Get or set angle of this sprite
        /// </summary>
        public float m_fAngle { get; set; }

        /// <summary>
        /// Get or set alpha chanle of this sprite ( alpha range : 0.0 - 1.0f )
        /// </summary>
        public float m_fAlpha { get; set; }

        /// <summary>
        /// Get or set a scaling factor for this sprite
        /// </summary>
        public Vector2 m_vecScale { get; set; }

        /// <summary>
        /// Get or set an origin for this sprite
        /// </summary>
        public Vector2 m_vecOrigin { get; set; }

        /// <summary>
        /// Get or set a sprite effect for this texture
        /// </summary>
        public SpriteEffects m_SpriteEffect { get; set; }

        /// <summary>
        /// Constructor for this class
        /// </summary>
        public CSprite()
        {
            m_pImage = null;
            m_pColor = new Color(255, 255, 255, 255);
            m_fAngle = 0.0f;
            m_fAlpha = 1.0f;
            m_vecScale = new Vector2(1.0f,1.0f);
            m_vecOrigin = new Vector2(0.0f,0.0f);
            m_SpriteEffect = SpriteEffects.None;
        }

        /// <summary>
        /// Rotate our sprite
        /// </summary>
        /// <param name="angle">angle to rotate</param>
        public void rotate(float angle)
        {
            m_fAngle += angle;
        }

        /// <summary>
        /// Fadding our sprite
        /// </summary>
        /// <param name="alpha">alpha ( range: 0.0f - 1.0f )</param>
        public void fadding(float alpha)
        {
            m_fAlpha += alpha;
        }

        /// <summary>
        /// Set the origin to the center of an image
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        public void setCenterOrigin(int width, int height)
        {
            m_vecOrigin = new Vector2(width / 2.0f, height / 2.0f);
        }


        public void draw(Vector2 pos , float deep , Rectangle recSource)
        {
            m_pImage.drawImage(pos, deep, recSource, m_fAlpha, m_pColor, m_fAngle, m_vecOrigin, m_vecScale, m_SpriteEffect);
        }
    }
}
